<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>鼠标滑过放大效果</title>
    <style>
    .clearfix:before,
    .clearfix:after {
        content: "";
        display: block;
        clear: both;
    }
    
    main {
        display: block;
        width: 1000px;
        margin: 0 auto;
    }
    
    ul {
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    li {
        position: relative;
        box-sizing: border-box;
        width: 33.333333%;
        list-style: none;
        height: 200px;
        line-height: 200px;
        border: 10px solid #FFFFFF;
        background-color: pink;
        float: left;
        text-align: center;
        font-size: 24px;
        color: #ffffff;
    }
    
    li>div {
        width: 100%;
        height: 100%;
    }
    
    li>div:first-child {
        /* 绝对定位与显示的盒子重合，不透明度为 0，z-index高于当前显示的盒子 */
        /* 如果是鼠标滑过，显示并放大该div，需要设置不透明度为 0，否则不 */
        background-color: blue;
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
        z-index: 10;
    }
    
    li>div:last-child {
        background-color: red;
    }
    
    li:hover>div:first-child {
        transition: 0.2s;
        transform: scale(1.2, 1.2);
        opacity: 1;
    }
    </style>
</head>

<body>
    <main class="clearfix">
        <ul>
            <li>
                <div>我是第1个盒子</div>
                <div>1</div>
            </li>
            <li>
                <div>我是第2个盒子</div>
                <div>2</div>
            </li>
            <li>
                <div>我是第3个盒子</div>
                <div>3</div>
            </li>
            <li>
                <div>我是第4个盒子</div>
                <div>4</div>
            </li>
            <li>
                <div>我是第5个盒子</div>
                <div>5</div>
            </li>
            <li>
                <div>我是第6个盒子</div>
                <div>6</div>
            </li>
        </ul>
    </main>
</body>

</html>
